//脚本唯一关键字,通过该关键字找到对应脚本，每个脚本必须有该描述。
var v_script_id = 'authtree_3';
//脚本状态,0:该脚本不许执行，1:该脚本可以执行
var v_status = '1';

//脚本逻辑写在run语句之间
if (run && (action.getSession().getAttribute("user").rolekind==1 || action.getSession().getAttribute("user").rolekind==2)){
	var id = action.form.getInteger('id');
	var title = action.form.getString('title');
	var kind = action.form.getInteger('kind');
	var note = action.form.getString('note');
	if(kind ==1){
		var tablename = action.form.getString('tablename');
		var vcol = action.form.getString('vcol');
		var pcol = action.form.getString('pcol');
		var condition = action.form.getString('condition');
	}
	var authtree = action.buildClass('com.handy.plugin.auth.action.AuthTree');
	var ret = authtree.update(id, title, kind, note, condition, pcol, vcol, tablename);
	if(ret==0) {
		action.errorCode = 0; 
		action.retString = '子类  ['+title+'] 修改成功!;'//错误文字说明
	}else if(ret==2){
		action.errorCode = 2; 
		action.retString = '修改操作失败!';//错误文字说明
	}else if(ret==3){
		action.errorCode = 3; 
		action.retString = '动态权限分配失败!请检查填写信息是否正确!';
	}
}